package com.rc.evcharger.protocol.ylevcharger.mq;

import com.rc.evcharger.common.config.RabbitListenerConstant;
import com.rc.evcharger.common.mq.MqConfig;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.CustomExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 交换器绑定队列与KEY
 */
@Configuration
public class YlDomain1QueueConfig {


    @Bean
    public Queue domain1YL01Queue() {
        return new Queue(RabbitListenerConstant.DOMAIN1_YL_CONTROLL_01_QUEUE);
    }

    @Bean
    public Queue domain1YL03Queue() {
        return new Queue(RabbitListenerConstant.DOMAIN1_YL_CONTROLL_03_QUEUE);
    }

    @Bean
    public Queue domain1YL6AQueue() {
        return new Queue(RabbitListenerConstant.DOMAIN1_YL_CONTROLL_6A_QUEUE);
    }

    @Bean
    public Queue domain1YL66Queue() {
        return new Queue(RabbitListenerConstant.DOMAIN1_YL_CONTROLL_66_QUEUE);
    }

    @Bean
    public Queue domain1YL68Queue() {
        return new Queue(RabbitListenerConstant.DOMAIN1_YL_CONTROLL_68_QUEUE);
    }

    @Bean
    public Queue domain1YLCAQueue() {
        return new Queue(RabbitListenerConstant.DOMAIN1_YL_CONTROLL_CA_QUEUE);
    }

    @Bean
    public Queue domain1YL06Queue() {
        return new Queue(RabbitListenerConstant.DOMAIN1_YL_CONTROLL_06_QUEUE);
    }

    @Bean
    public Queue domain1YL08Queue() {
        return new Queue(RabbitListenerConstant.DOMAIN1_YL_CONTROLL_08_QUEUE);
    }

    @Bean
    public Queue chargeLogQueue() {
        return new Queue(RabbitListenerConstant.DOMAIN_LOG_CHARGED_PROCESS_QUEUE);
    }

    @Bean
    public Queue priceRquestQueue() {
        return new Queue(RabbitListenerConstant.DOMAIN1_YL_CONTROLL_4F_04_QUEUE);
    }

    @Bean
    public Queue open2AppQueue() {
        return new Queue(MqConfig.OPEN2APP_NOTIFY_STOP_CHARGE_RESULT);
    }


    /*
     ***********************************todo 建立绑定关系***************************************************
     *
     * */

    @Bean
    public Binding domain1Yl01Binding(CustomExchange customExchange) {
        return BindingBuilder.bind(domain1YL01Queue()).to(customExchange).with(RabbitListenerConstant.DOMAIN1_YL_CONTROLL_01_QUEUE).noargs();
    }

    @Bean
    public Binding domain1Yl03Binding(CustomExchange customExchange) {
        return BindingBuilder.bind(domain1YL03Queue()).to(customExchange).with(RabbitListenerConstant.DOMAIN1_YL_CONTROLL_03_QUEUE).noargs();
    }

    @Bean
    public Binding domain1Yl6ABinding(CustomExchange customExchange) {
        return BindingBuilder.bind(domain1YL6AQueue()).to(customExchange).with(RabbitListenerConstant.DOMAIN1_YL_CONTROLL_6A_QUEUE).noargs();
    }

    @Bean
    public Binding domain1Yl66Binding(CustomExchange customExchange) {
        return BindingBuilder.bind(domain1YL66Queue()).to(customExchange).with(RabbitListenerConstant.DOMAIN1_YL_CONTROLL_66_QUEUE).noargs();
    }

    @Bean
    public Binding domain1YL68QueueBinding(CustomExchange customExchange) {
        return BindingBuilder.bind(domain1YL68Queue()).to(customExchange).with(RabbitListenerConstant.DOMAIN1_YL_CONTROLL_68_QUEUE).noargs();
    }

    @Bean
    public Binding domain1YLCAQueueBinding(CustomExchange customExchange) {
        return BindingBuilder.bind(domain1YLCAQueue()).to(customExchange).with(RabbitListenerConstant.DOMAIN1_YL_CONTROLL_CA_QUEUE).noargs();
    }

    @Bean
    public Binding domain1YL06QueueBinding(CustomExchange customExchange) {
        return BindingBuilder.bind(domain1YL06Queue()).to(customExchange).with(RabbitListenerConstant.DOMAIN1_YL_CONTROLL_06_QUEUE).noargs();
    }

    @Bean
    public Binding domain1YL08QueueBinding(CustomExchange customExchange) {
        return BindingBuilder.bind(domain1YL08Queue()).to(customExchange).with(RabbitListenerConstant.DOMAIN1_YL_CONTROLL_08_QUEUE).noargs();
    }

    @Bean
    public Binding chargeLogQueueBinding(CustomExchange customExchange) {
        return BindingBuilder.bind(chargeLogQueue()).to(customExchange).with(RabbitListenerConstant.DOMAIN_LOG_CHARGED_PROCESS_QUEUE).noargs();
    }

    @Bean
    public Binding priceRequestQueueBinding(CustomExchange customExchange) {
        return BindingBuilder.bind(priceRquestQueue()).to(customExchange).with(RabbitListenerConstant.DOMAIN1_YL_CONTROLL_4F_04_QUEUE).noargs();
    }

    @Bean
    public Binding open2AppQueueBinding(CustomExchange customExchange) {
        return BindingBuilder.bind(open2AppQueue()).to(customExchange).with(MqConfig.OPEN2APP_NOTIFY_STOP_CHARGE_RESULT).noargs();
    }

}
